package com.reignite.messaging.server;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

/**
 * This file is part of r-amf.
 * 
 * r-amf is free software: you can redistribute it and/or modify it under the
 * terms of the GNU General Public License as published by the Free Software
 * Foundation, either version 3 of the License.
 * 
 * r-amf is distributed in the hope that it will be useful, but WITHOUT ANY
 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License along with
 * r-amf. If not, see <http://www.gnu.org/licenses/>.
 * 
 * Created by Surrey Hughes of Reignite Pty Ltd <http://www.reignite.com.au>
 * 
 * A service called by an endpoint in a RAMFServer.
 * 
 * @author Surrey
 * 
 */
public class RAMFService implements Service {

	private Object remoteService;
	private Method method;
	private Object[] params;

	public RAMFService(Object target, Method method, Object[] params) {
		this.remoteService = target;
		this.method = method;
		this.params = params;
	}

	@Override
	public Object invoke() throws IllegalAccessException, IllegalArgumentException, InvocationTargetException {
		return method.invoke(remoteService, params);
	}

}
